package com.sky.mapper.common;

import com.sky.pojo.ShotUri;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface ShortUrlInfoMapper {

    @Insert("insert into tb_short_url_info (short_url,full_url,short_code,expire_time,trade_no) " +
            "values(#{shotUrl},#{fullUrl},#{shortCode},#{expireTime},#{tradeNo})")
    void insert(ShotUri shortUrl);

    @Select("select full_url from tb_short_url_info where short_code = #{code}")
    String queryFullUriByCode(String code);

    @Select("select short_code from tb_short_url_info where trade_no = #{tradeNo}")
    String selectByTradeNo(Long tradeNo);

    @Delete("delete from tb_short_url_info where trade_no = #{tradeNo}")
    void deleteByTradeNo(Long tradeNo);
}
